<template>
  <div>
    <van-nav-bar
      :title="type == 'study'?'学习模式':'考试模式'"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <exam />
    <examCountDown class="count-down" />
    <examNum :total="total" />
  </div>
</template>

<script>
import { mapActions, mapMutations } from "vuex";
import exam from "../components/exam/exam.vue";
import examCountDown from "../components/exam/examCountDown.vue";
import examNum from "../components/exam/examNum.vue";
export default {
  name: "testcontent",
  components: {
    exam,
    examCountDown,
    examNum
  },
  mounted() {
    this.getList();
  },
  computed: {
    type() {
      return this.$store.state.exam.type;
    },
    total() {
      return this.$store.state.exam.list.length;
    }
  },
  methods: {
    ...mapActions("exam", ["getList"]),
    ...mapMutations("exam", ["setCurrent"]),
    onClickLeft() {
      this.$router.back();
      this.setCurrent(0);
    }
  }
};
</script>

<style scoped>
.count-down {
  position: absolute;
  top: 50px;
  right: 10px;
}
</style>